package games.graphPath;

import games.graphPath.Graph.Edge;
import games.graphPath.Graph.Vertex;

import java.util.ArrayList;
import java.util.LinkedList;

public class GraphPathGradientState  implements Comparable<GraphPathGradientState>{
	
	private Graph _grpah;
	
	private Vertex _from;
	
	private Vertex _to;
	
	private int _cost;
	
	/*
	public GraphPathGradientState(Graph g, GraphPathGradientState prev, LinkedList<Edge> path){
		_grpah = g;
		_father = prev;
		_hash = "";
		_cost = 0;
		for (Edge edge:path)
		{
			_hash+=edge.getSrc().getIndex();
			_cost += edge.getCost();
		}
		_hash+=path.getLast().getDst().getIndex();
		
	}*/

	public GraphPathGradientState(Vertex from, Vertex to, int cost) {
		_from = from;
		_to = to;
		_cost = cost;
	}

	public int getCost() {
		return _cost;
	}

	/*
	public GraphPathGradientState getFather() {
		return _father;
	}
	*/

	public ArrayList<GraphPathGradientState> getPossibleMoves(boolean forward) {
		// TODO Auto-generated method stub
		return null;
	}

	/*
	public String hash() {
		return _hash;
	}
	*/

	/*
	public boolean isWin() {
		return _path.getFirst().equals(_grpah.getSrc()) && _path.getLast().equals(_grpah.getDst());
	}
	*/

	public int compareTo(GraphPathGradientState o) {
		return new Integer(_cost).compareTo(new Integer(o.getCost()));
	}

	public int getIndex(boolean forward) {
		if (forward)
			return _to.getIndex();
		
		else
			return _from.getIndex();
	}
	
	public Vertex getVertex(boolean forward)
	{
		if (forward)
			return _to;
		
		else
			return _from;
	}

}
